// Skinned Mesh
// (c) jimon game studio

#ifndef JEH_CSKINNEDMESH
#define JEH_CSKINNEDMESH

#include "jeMesh.h"

namespace je
{
	namespace scene
	{
		//! Skinned Mesh
		class CSkinnedMesh:public je::jeUnknown
		{
		protected:
			struct SkinnedSurface
			{
				video::IHardwareBufferArray * BindPose;
				video::IHardwareBufferArray * Skinned;
			};

			typedef jeDynamicArray<SkinnedSurface*> SkinnedSurfacesType;
			SkinnedSurfacesType SkinnedSurfaces;

			jeMesh * MeshWithSkeleton;
			video::IRender * CurrentRender;

			//! Create Skinned Arrays
			void CreateSkinnedArrays();
		public:
			//! Constructor
			CSkinnedMesh(jeMesh * SkinnedMesh,video::IRender * Render);

			//! Destructor
			~CSkinnedMesh();

			//! Software Calculate Skin
			virtual void SoftwareCalculateSkin(u32 AnimationId,f32 Time,u1 EnableInterpolation = true);

			//! Software Restore Arrays
			virtual void SoftwareRestoreArrays();
		};
	}
}

#endif